package neu.soft.controller;

import neu.soft.entity.Inventory;
import neu.soft.service.impl.InventoryServiceImpl;
import neu.soft.vo.PageBean;
import neu.soft.vo.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/inventory")
public class InventoryController {
    @Autowired
    private InventoryServiceImpl inventoryService;

    @RequestMapping(value = "/queryInventoryInfo")
    public ResultBean<PageBean<Map<String,Object>>> queryInventoryInfo(@RequestBody Map<String,Object> map){
        return inventoryService.queryInventoryInfo(map);
    }

    @RequestMapping(value = "/showAllInventory")
    public ResultBean<PageBean<Map<String,Object>>> showAllInventory(@RequestBody Map<String,Object> map){
        return inventoryService.showAllInventory(map);
    }

    @RequestMapping(value = "/addInventory")
    public ResultBean<Integer> addInventory(@RequestBody Map<String,Object> map){
        return inventoryService.addInventory(map);
    }

    @RequestMapping(value = "/deleteInventory")
    public ResultBean<Integer> deleteInventory(@RequestBody Map<String,Object> map){
        return inventoryService.deleteInventory(map);
    }

    @RequestMapping(value = "/increaseInventoryNum")
    public ResultBean<Integer> increaseInventoryNum(@RequestBody Map<String,Object> map){
        return inventoryService.increaseInventoryNum(map);
    }

    @RequestMapping("/queryInventoryNum")
    public ResultBean<Integer> queryInventoryNum(@RequestBody Map<String,Object> map){
        return inventoryService.queryInventoryNum(map);
    }

    @RequestMapping("/queryInventoryByCodeList")
    public List<Inventory> queryInventoryByCodeList(@RequestBody List<String> codeList){
        return inventoryService.queryInventoryByCodeList(codeList);
    }

    @RequestMapping("/queryInventoryByWarehouseId")
    public ResultBean<List<Map<String,Object>>> queryInventoryByWarehouseId(int warehouseId){
        return inventoryService.queryInventoryByWarehouseId(warehouseId);
    }
}
